package com.vf.cloud.paas.app.agent.common.scheduled;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.vf.cloud.paas.common.cirrus.Cirrus;

@Component
@EnableScheduling
public class RenderClientScheduled {
	@Value("${agent.enabled}")
	private boolean agentEnabled;

	@Scheduled(fixedRate = 5000)
	@Async
	public void scheduled() {
		if(agentEnabled) {
			if(Cirrus.isRenderClientConnectedCompleted && !Cirrus.isRenderClientConnected && Cirrus.renderClient!=null) {
				Cirrus.renderClient.run();
			}
		}

	}
}
